#include<stdio.h>
int main()
{
    int n,i,j,k,l,cnt=0;
    scanf("%d",&n);
    int shuzu[n-1];
    int shuzu2[n-1];
    for(i=0;i<n;i++)
    {
        scanf("%d",&shuzu[i]);
    }
    for(j=0;j<n;j++)
    {
      if(shuzu[j]%2==0)
      {
          shuzu2[cnt]=shuzu[j];
          cnt++;
      }
    }
    for(k=0;k<n;k++)
    {
        if(shuzu[k]%2!=0)
        {
            shuzu2[cnt]=shuzu[k];
            cnt++;
        }
    }
    for(l=0;l<cnt;l++) 
    {
        printf("%d",shuzu2[l]);
        if(l!=cnt) printf(" ");
        else printf("\n");
    }
    return 0;

}